_aaaa_tttt_oooo_mmmm_iiii_cccc______aaaa_llll_llll_oooo_cccc______rrrr_eeee_ssss______iiii_dddd_eeee_nnnn_tttt_((((_)))) Establishes a system-wide unique reservoir id
that can be used by unrelated processes (not in the same address space)
to allocate a reservoir out of which they can obtain variables. _c_o_u_n_t
indicates the number of variables the user will wish to use.
_aaaa_tttt_oooo_mmmm_iiii_cccc______aaaa_llll_llll_oooo_cccc______rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr_((((_)))) Initializes a atomic variable reservoir sized to
hold a _c_o_u_n_t variables. In systems with special hardware for atomic
operations, the reservoir may be allocated in a special region of memory.
When hardware support is not provided, the reservoir is allocated in the
process heap. In either case the memory is pinned down so care should be
taken to allocate only the number of variables that are going to be used.
If NULL is passed for the _r_e_s__i_d, the memory will be mapped from
/dev/zero. If something other than NULL is passed in as the res_ident,
then the memory is allocated from shared memory (see shmget(2)). Care
should be taken to call _a_t_o_m_i_c__f_r_e_e__r_e_s_e_r_v_o_i_r upon exiting. If a program
exits prematurely then the shared memory can be removed by hand with
_i_p_c_r_m(1).
The policy module specified in _p_o_l_i_c_y is used to indicate where to place
the atomic variables, if users care about the locality of the variables
on a Non-Uniform Memory Access (NUMA) platforms. If no particular policy
module is required, pass the constant USE_DEFAULT_PM. The system will
allocate the atomic variables using the default policy for the user
process.
The handle of the reservoir is returned if the function is successful.
This handle is used to allocate variables. NULL is returned if a
reservoir could not be allocated.
_aaaa_tttt_oooo_mmmm_iiii_cccc______aaaa_llll_llll_oooo_cccc______rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr______aaaa_dddd_dddd_rrrr_((((_)))) Similar to _a_t_o_m_i_c__a_l_l_o_c__r_e_s_e_r_v_o_i_r() except
that it is possible either to set or to get the address of the base
address of the variables. If ATOMIC_GET_VADDR is passed in for the
_f_l_a_g_s, the _v_a_d_d_r will have the value where the variables were placed. If
ATOMIC_SET_VADDR is passed in for the _f_l_a_g_s, then _v_a_d_d_r is taken as the
location where the library is supposed to place the variables. A failure
to place the base of the variables at this location is considered a
failure, and NULL is returned.
_aaaa_tttt_oooo_mmmm_iiii_cccc______aaaa_llll_llll_oooo_cccc______vvvv_aaaa_rrrr______iiii_dddd_eeee_nnnn_tttt_((((_)))) Establishes a system-wide unique variable id for
this _r_e_s_e_r_v_o_i_r that can be used by unrelated processes (not in the same
address space) to allocate a variable with the guarantee that each will
obtain access to the same memory. Upon success the identifier is
returned else NULL is returned.
_aaaa_tttt_oooo_mmmm_iiii_cccc______aaaa_llll_llll_oooo_cccc______vvvv_aaaa_rrrr_iiii_aaaa_bbbb_llll_eeee_((((_)))) Allocates a variable from the given reservoir.
If all processes are within one address space, the var_id can be NULL
otherwise the value returned by _a_t_o_m_i_c__a_l_l_o_c__v_a_r__i_d_e_n_t() should be used.
Upon success a handle to the the variable is returned else NULL is
returned.
_aaaa_tttt_oooo_mmmm_iiii_cccc______ssss_eeee_tttt______pppp_eeee_rrrr_mmmm_ssss_((((_)))) Meaningful only in the case when
_a_t_o_m_i_c__a_l_l_o_c__v_a_r__i_d_e_n_t() has been called to establish mapping between
unrelated processes. This call allows the mapping to also occur between
programs running under different userids. Upon success 0 is returned,
else -1 is returned with errno set.
_aaaa_tttt_oooo_mmmm_iiii_cccc______ffff_rrrr_eeee_eeee______vvvv_aaaa_rrrr_iiii_aaaa_bbbb_llll_eeee_((((_)))) Frees an atomic variable so that it can be reused.
_aaaa_tttt_oooo_mmmm_iiii_cccc______ffff_rrrr_eeee_eeee______vvvv_aaaa_rrrr______iiii_dddd_eeee_nnnn_tttt_((((_)))) Used only in when processes are sharing address
space. Frees the variable identifier so that it can be re-used to
allocate another variable.
_aaaa_tttt_oooo_mmmm_iiii_cccc______ffff_rrrr_eeee_eeee______rrrr_eeee_ssss_eeee_rrrr_vvvv_oooo_iiii_rrrr_((((_)))) Frees the atomic reservoir. It is especially
important that this is called in programs using fetchop across address
spaces. If the program fails to call _a_t_o_m_i_c__f_r_e_e__r_e_s_e_r_v_o_i_r() either
because the code was not in the program or the program exits prematurely,
the shared memory segments can, and should be cleaned up "by hand" by
_aaaa_tttt_oooo_mmmm_iiii_cccc______ssss_tttt_oooo_rrrr_eeee_((((_)))) Stores _v_a_l_u_e in the memory addressed by var.
_aaaa_tttt_oooo_mmmm_iiii_cccc______ssss_tttt_oooo_rrrr_eeee______aaaa_nnnn_dddd______oooo_rrrr_((((_)))) _v_a_l_u_e is bit-wise ORed with the data address by
var.
_aaaa_tttt_oooo_mmmm_iiii_cccc______ssss_tttt_oooo_rrrr_eeee______aaaa_nnnn_dddd______aaaa_nnnn_dddd_((((_)))) _v_a_l_u_e is bit-wise ANDed with the data address by
var.
_aaaa_tttt_oooo_mmmm_iiii_cccc______llll_oooo_aaaa_dddd_((((_)))) The value of the memory addressed by _v_a_r is returned.
_aaaa_tttt_oooo_mmmm_iiii_cccc______ffff_eeee_tttt_cccc_hhhh______aaaa_nnnn_dddd______iiii_nnnn_cccc_rrrr_eeee_mmmm_eeee_nnnn_tttt_((((_)))) The memory addressed by _v_a_r is incremented
by 1 and the previous value is returned.
_aaaa_tttt_oooo_mmmm_iiii_cccc______ffff_eeee_tttt_cccc_hhhh______aaaa_nnnn_dddd______dddd_eeee_cccc_rrrr_eeee_mmmm_eeee_nnnn_tttt_((((_)))) The memory addressed by _v_a_r is decremented